<%--
  Created by IntelliJ IDEA.
  User: 4S
  Date: 2021/11/3
  Time: 14:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<p>添加实习经历</p>
    <table>
        <tr>
            <td colspan="2">
                <div class="layui-inline">
                    <label class="layui-form-label">公司名称</label>
                    <div class="layui-input-inline">
                        <input type="text" id="companyName" class="layui-input" placeholder="请填写公司名称"
                               value="" style="width: 490px">
                    </div>
                </div>
            </td>
            <td></td>
        <tr>
            <td>
                <div class="layui-inline">
                    <label class="layui-form-label">公司行业</label>
                    <div class="layui-input-inline">
                        <input type="text" id="companyIndustry" class="layui-input" placeholder="请填写公司行业"
                               value="">
                    </div>
                </div>
            </td>
            <td>
                <div class="layui-inline">
                    <label class="layui-form-label">职位名称</label>
                    <div class="layui-input-inline">
                        <input type="text" id="title" class="layui-input" placeholder="请填写职位名称"
                               value="">
                    </div>
                </div>
            </td>
        </tr>

        <tr>
            <td colspan="2">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">起止日期</label>
                        <div class="layui-inline" id="test-range">
                            <div class="layui-input-inline">
                                <input type="text" id="startDate" class="layui-input" placeholder="开始时间"
                                       value=""
                                       style="width: 213.4px">
                            </div>
                            <div class="layui-form-mid">-</div>
                            <div class="layui-input-inline">
                                <input type="text" id="endDate" class="layui-input" placeholder="结束时间"
                                       value=""
                                       style="width: 213.4px">
                            </div>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">实习经历</label>
                    <div class="layui-input-block">
                            <textarea name="desc" id="content" placeholder="请填写工作内容（不超过500字）"
                                      class="layui-textarea" value=""></textarea>
                    </div>
                </div>
            </td>
        </tr>
    </table>
<button class="button_save"  onclick="button_intern_save()">保存并更新</button>
<button class="button_cancel" id="button_intern_cancel">取消</button>
</body>
</html>
<script>
function button_intern_save(){
    let resumeId = $("#resumeId").val();
    // let internId = $("#internId").val();
    let companyName = $("#companyName").val();
    let companyIndustry = $("#companyIndustry").val();
    let title = $("#title").val();
    let startDate = $("#startDate").val();
    let endDate = $("#endDate").val();
    let content = $("#content").val();
    let param = "resumeId=" + resumeId + "&companyName=" + companyName + "&companyIndustry=" + companyIndustry
        + "&title=" + title + "&startDate=" + startDate + "&endDate=" + endDate + "&content=" + content;
    console.log(param);
    $.post('/hire/resume/intern/insert', param, function (res) {
        if (res.code == '200') {
            $("#intern_info").load("/hire/resume/intern_info", {id: resumeId});
            $("#intern_edit").hide();
            $("#intern_info").show();
        } else {
            layer.msg(res.msg);
        }
    })
}
    $("#button_intern_cancel").click(function () {
        let resumeId = $("#resumeId").val();
        $("#intern_info").load("/hire/resume/intern_info", {id: resumeId});
        $("#intern_edit").hide();
        $("#intern_info").show();
    })
    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#startDate' //指定元素

        });
    });
    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#endDate' //指定元素

        });
    });
</script>
